<% layout('/layout/default.html', {title: '已发任务', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa fa-cubes"></i> 已发任务
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="查询" ><i class="fa fa-filter"></i> 查询</a>
			</div>
		</div>
		<div class="box-body">
			<form id="searchForm" action="${ctx}/act/task/hasSentData" method="post" class="form-inline hide" >
				<div class="form-group">
					<label class="control-label">全部分类：</label>
					<div class="control-inline">
						<#form:select path="category" name="label" data="getDictList:act_category" class="form-control required">
						</#form:select>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">查询</button>
					<button type="reset" class="btn btn-default btn-sm">重置</button>
				</div>
			</form>			
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
//初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'hisProcInsId', name:'hisProcInsId', index:'hisProcInsId', width:90, align:"center"},
		{header:'流程标识', name:'procDefKey', index:'procDefKey', width:90, align:"center"},
		{header:'流程名称', name:'procDefname', index:'procDefname', width:50, align:"center" },
		{header:'流程版本', name:'procDefversion', index:'procDefversion', width:50, align:"center",formatter: function(val, obj, row, act){
			return 'V:'+val;
		}},
		{header:'流程状态', name:'processIsFinished', width:50, align:"center",formatter: function(val, obj, row, act){
			return row.processIsFinished=="finished"?"结束":"未结束";
		}},
		{header:'开始时间', name:'createTime', index:'createTime', width:100, align:"center",formatter:"date",formatoptions:{srcformat: 'Y-m-d H:i:s',newformat: 'Y-m-d H:i:s'}},
		{header:'操作', name:'actions', width:100, sortable:false, title:false, align:"center",formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('act:process:edit')){ %>
				if(row.processIsFinished=="finished"){
					actions.push('<a href="${ctx}/act/task/diagramViewer?definitionId='+row.procDefId+'&hisInsId='+row.procInsId+'" class="btnList" data-type="diagram" title="流程追踪">跟踪</a>&nbsp;');
				}else{
					actions.push('<a href="${ctx}/act/task/diagramViewer?definitionId='+row.procDefId+'&instanceId='+row.procInsId+'" class="btnList" data-type="diagram" title="流程追踪">跟踪</a>&nbsp;');
				}
				actions.push('<a href="/act/task/form?taskId='+row.taskId+'&taskName='+row.taskName+'&taskDefKey='+row.taskDefKey+'&procInsId='+row.procInsId+'&procDefId='+row.procDefId+'&status='+row.status+'" class="btnList" title="查看详情">查看详情</a>&nbsp;');
			<% } %>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>